package zongbao.controller;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import zongbao.domain.Book;
import zongbao.service.BookService;


@Controller
public class BookController {
    @Autowired
    private BookService bookService;
    ///book?id=1
    @RequestMapping("/book")
    public ModelAndView findBookById(Integer id){
        Book book=bookService.findBookById(id);
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("book");
        modelAndView.addObject("book",book);
        return modelAndView;
    }
}
